package com.captain.special.二叉树;

import com.captain.leetcode.TreeNode;

/**
 * Des:
 *
 * @author XL
 * @Date 2022/4/24 10:51
 */
public class 二叉树的深度Offer55 {
    public int maxDepth(TreeNode root) {
        return recur(root);
    }

    public int recur(TreeNode node) {
        if (node == null) return 0;
        int left = recur(node.left);
        int right = recur(node.right);
        return Math.max(left, right) + 1;
    }
}
